package gui;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagLayout;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import java.awt.Dimension;
import javax.swing.JLabel;

import code.Language;
import code.Settings;

import java.awt.Rectangle;
import java.io.File;
import java.util.HashMap;
import javax.swing.JTextArea;

public class EncryptionType extends JPanel {
	
	Color c= new Color(0x80, 0x80, 0xFF);
	
	Color TAc = new Color(246, 250, 250);

	private static final long serialVersionUID = 1L;
	private JLabel jLabel = null;
	private JLabel jLabel1 = null;

	private JLabel jLabel2 = null;

	private JLabel jLabel3 = null;

	ATOCOmain atocoframe;
	
	private HashMap labels;

	private JTextArea jTextArea = null;
	
	private JScrollPane scroll = null;

	private JLabel jLabel4 = null;
	private Settings s;
	
	/**
	 * This is the default constructor
	 */
	public EncryptionType(ATOCOmain atocoframe) {
		super();
		Settings s = new Settings();
		Language l = new Language();
		labels = l.changeLanguage((String) s.global.get("language"), "EncryptionType", (String) s.global.get("installPath"));
		initialize();
		this.setPreferredSize( new Dimension( 400, 500 ) );
		this.atocoframe = atocoframe;
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		jLabel4 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/help_icon.jpg"));
		jLabel4.setBounds(new Rectangle(6, 288, 81, 82));
		jLabel4.setVisible(false);
		jLabel3 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel3.setBounds(new Rectangle(400, 150, 25, 25));
		jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jTextArea.setVisible(true);
				jTextArea.setText((String) labels.get("asimhelp"));
				jLabel4.setVisible(true);
			}
		});
		
		
		jLabel2 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel2.setBounds(new Rectangle(40, 150, 25, 25));
		jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jTextArea.setVisible(true);
				jTextArea.setText((String) labels.get("simhelp"));
				jLabel4.setVisible(true);
			}
		});
		
		ImageIcon asim = new ImageIcon((String) labels.get("asim"));
		jLabel1 = new JLabel(asim);
		jLabel1.setBounds(new Rectangle(435, 35, 290, 295));
		jLabel1.setForeground(c);
		jLabel1.setFont(new java.awt.Font("Comic Sans MS", Font.BOLD, 15));
		jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new AsymmetricRSAEncryption(atocoframe));
			}
		});
		ImageIcon sim = new ImageIcon((String) labels.get("sim"));
		jLabel = new JLabel(sim);
		jLabel.setBounds(new Rectangle(80, 35, 290, 295));
		jLabel.setText("");
		jLabel.setForeground(c);
		jLabel.setFont(new java.awt.Font("Comic Sans MS", Font.BOLD, 15));
		jLabel.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new FileEncryption(atocoframe));
			}
		});
		this.setSize(759, 437);
		this.setLayout(null);
		this.add(jLabel, null);
		this.setBackground(Color.WHITE);
		this.add(jLabel1, null);
		this.add(jLabel2, null);
		this.add(jLabel3, null);
		this.add(getJTextArea(), null);
//		this.add(scroll);
		this.add(jLabel4, null);
	}

	/**
	 * This method initializes jTextArea	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getJTextArea() {
		if (jTextArea == null) {
			jTextArea = new JTextArea();
			jTextArea.setBounds(new Rectangle(97, 297, 590, 161));
			jTextArea.setFont(new Font("Arial", Font.ITALIC, 12));
			jTextArea.setLineWrap(true);
			
//			scroll = new JScrollPane(jTextArea);
//			scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
//			scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
			jTextArea.setBackground(TAc);
			jTextArea.setEditable(false);
			jTextArea.setVisible(false);
		}
		return jTextArea;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
